package cn.lisens.demo.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.lisens.demo.entity.User;
import cn.lisens.demo.mapper.UserMapper;

@Service
public class UserService {

	private final UserMapper userMapper;
    
    public UserService(UserMapper userMapper) {
        this.userMapper = userMapper;
    }
    
    public User getUserById(Long id) {
        return userMapper.findById(id);
    }
    
    @Transactional
    public void createUser(User user) {
        userMapper.insert(user);
    }
}
